<link href="/mobile/css/bootstrap-datetimepicker.css" rel="stylesheet" media="screen">
<div class="order">
    <!--begin map-->
    <div class="map">
        <a class="index" href="/index">首页</a>&nbsp;&gt;&nbsp;<a href="/index/goods/andorder.html">订单</a>&nbsp;&gt;&nbsp;新增订货单
    </div>
    <!--end map-->

    <!--begin main-->
    <form autocomplete="off"   action="/index/goods/addOrder" method="post"  >
        <div class="main-t">
            <div class="control-box ui-page-tab-con">
                <div class="grid-wrap">
                    <div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all" id="gbox_grid" dir="ltr" style="width: 1333px;">
                        <div class="ui-widget-overlay jqgrid-overlay" id="lui_grid"></div>
                        <div class="loading ui-state-default ui-state-active" id="load_grid" style="display: none;">读取中...</div>
                        <div class="ui-jqgrid-view" role="grid" id="gview_grid" style="width: 1333px;">
                            <div style="position:fixed;top:0px;width:1px;height:1px;" tabindex="0">
                                <div tabindex="-1" style="width:1px;height:1px;" id="grid_kn"></div>
                            </div>
                            <div class="ui-jqgrid-titlebar ui-jqgrid-caption ui-widget-header ui-corner-top ui-helper-clearfix" style="display: none;">
                                <a role="link" class="ui-jqgrid-titlebar-close ui-corner-all HeaderButton" title="Toggle Expand Collapse Grid" style="right: 0px;">
                                    <span class="ui-icon ui-icon-circle-triangle-n"></span>
                                </a><span class="ui-jqgrid-title"></span>
                            </div>
                            <div class="ui-state-default ui-jqgrid-hdiv ui-corner-top" style="width: 1333px;">
                                <div class="ui-jqgrid-hbox">
                                    <table class="ui-jqgrid-htable" style="width: 1332px;" role="presentation" aria-labelledby="gbox_grid" cellspacing="0" cellpadding="0" border="0">
                                        <thead>
                                            <tr class="ui-jqgrid-labels" role="row">
                                                <th class="ui-state-default ui-th-column ui-th-ltr" style="width: 25px;">
                                                </th>
                                                <th  class="ui-state-default ui-th-column ui-th-ltr" style="width: 535px;">产品
                                                </th>
                                                <th class="ui-state-default ui-th-column ui-th-ltr" style="width: 101px;">数量
                                                </th>
                                                <th i class="ui-state-default ui-th-column ui-th-ltr" style="width: 126px;">单位
                                                </th>
                                                <th  class="ui-state-default ui-th-column ui-th-ltr" style="width: 100px;">备注
                                                </th>
                                            </tr>
                                        </thead>
                                    </table>
                                </div>
                            </div>
                            <div class="ui-jqgrid-bdiv" style="height: auto; width: 1333px;">
                                <div style="position:relative;">
                                    <div></div>
                                    <table id="grid" tabindex="0" cellspacing="0" cellpadding="0" border="0" role="presentation" aria-multiselectable="false" aria-labelledby="gbox_grid" class="ui-jqgrid-btable" style="width: 1332px;">
                                        <tbody>
                                        <tr class="jqgfirstrow" role="row" style="height:auto">
                                            <td style="height:0px;width:25px;"></td>
                                            <td style="height:0px; width: 535px;"></td>
                                            <td style="height:0px;width:101px;"></td>
                                            <td style="height:0px;width:126px;"></td>
                                            <td style="height:0px;width:100px;"></td>
                                        </tr>
                                        {foreach name="$shoppingCartList" item="vo"}
                                            <tr role="row" id="1" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr ">
                                                <td style="text-align:center;">{$key+1}</td>
                                                <td style="text-align:center;">{$vo.name}&nbsp;&nbsp;({if $vo.type==1}半成品{else}成品{/if})</td>
                                                <td style="text-align:center;">{$vo.number}</td>
                                                <td style="text-align:center;">套</td>
                                                <td style="text-align:center;"><textarea class="ui-textarea-line ui-textarea-auto inp-remark" data-id="{$vo.sid}" >{$vo.remark}</textarea></td>
                                            </tr>
                                        {/foreach}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="ui-jqgrid-resize-mark" id="rs_mgrid">&nbsp;</div>
                    </div>
                </div>
                <div class="control-group remark">
                    <label class="control-label">填写备注：</label>
                    <div class="control-input">
                        <textarea class="ui-textarea-line ui-textarea-auto"  name="remark" placeholder="在此填写备注信息..."></textarea>
                    </div>
                </div>
                <div class="control-group delivery-date">
                    <label class="control-label">交货日期：</label>
                    <div class="control-input delivery-info">
                        <input type="text" class="ui-datepicker-inp datetimepickerStart"  name="time" id="deliveryDate" autocomplete="off" readonly="readonly">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label address-add">收货信息：</label>
                    <div class="control-input address-info" style="">
                        <a href="javascript:void(0);" class="ui-op ui-op-edit"  title="编辑">编辑</a>
                        {if !empty($default)}
                            <input type="hidden" class="addressId yl-add-del" name="addressid" autocomplete="off" value="{$default.id}">
                            <em class="yl-add-del">收货人：</em><span class="contactor yl-add-del">{$default.lxr}</span>
                            <em class="yl-add-del"> 联系电话：</em><span class="mobile yl-add-del">{$default.mobile}</span>
                            <em class="yl-add-del">收货地址：</em><span class="address yl-add-del">{$default.province_text},{$default.city_text},{$default.area_text},{$default.address}</span>
                            <span class="provinceId dn yl-add-del">{$default.province}</span>
                            <span class="districtId dn yl-add-del">{$default.city}</span>
                            <span class="cityId dn yl-add-del">{$default.area}</span>
                        {/if}
                    </div>
                </div>
            </div>
        </div>
        <div class="control-box  saveBox">
            <div class="saveBg"></div>
            <button class="ui-btn ui-btn-theme " style="position: absolute;bottom: 10px;left: 20px;" id="button" >保存</button>
            <button class="ui-btn ui-btn-default cancel"  onclick="javascript:history.back(-1);">取消</button>
        </div>
    </form>
    <!--end main-->
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/mobile/src/jquery-ui.min.js"></script>
<link href="/mobile/src/jquery-ui.min.css" rel="stylesheet" />
<script type="text/javascript" src="/mobile/src/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/mobile/src/i18n/jquery-ui-timepicker-zh-CN.js?v=2"></script>
<link href="/mobile/src/jquery-ui-timepicker-addon.css" rel="stylesheet" />
<script>
    $(function () {
      $.datepicker.setDefaults($.timepicker.regional['zh-CN']);
      $("#deliveryDate").datetimepicker();

      $('.inp-remark').blur(function () {
        var id = $(this).attr('data-id');
        //修改备注
        $.ajax({
          type: "POST",
          url: "remark/ids/"+id,
          data: {remark:$(this).val()},
          dataType: "json",
          success: function(data){
            layer.msg(data.msg);
          }
        });

      });

      $('.ui-op-edit').on('click',function () {
        layer.open({
          type: 2,
          title: '修改收货地址',
          shadeClose: true,
          shade: 0.1,
          area: ['50%', '50%'],
          content: '/index/goods/addressEdit' //iframe的url
        });
      });
      //表单验证
      $("form").submit(function(e){
        //收货人信息
        var addressid = $('.addressId').val();
        if(addressid <= 1)
        {
          layer.msg('请选择收货信息');
          return false
        }
        return true
      });

    })
</script>